<?php
	class NoticeAction extends CommonAction{
		function _filter(&$map){
			$map['lang'] = $this->lang;
		}
		
		public function _tigger_insert($model){
			$this->checkSession();
		}
		
		public function _tigger_update($model){
			$this->checkSession();
		}
		
		public function index(){
			$model = M('Notice');
			
			import( 'ORG.Util.Page' );
			$total = $model->where( $where )->count();
			$p = new Page( $total, C('LIST_GRID_NUMBER') );
			$list = $model->where( $where )->order('id DESC')->limit( $p->firstRow . ',' . $p->listRows )->select();
			$this->assign( 'page', $p->show() );
			$this->assign( 'list', $list );
			$this->assign("jumpUrl", Cookie::set('_currentUrl_', __SELF__));
			$this->display();
		}
		
		//批量删除
		public function submit(){
			$model = D('Notice');
			if ( count( $_POST['ids'] ) > 0 ){
				$where['id'] = array( 'in', $_POST['ids'] );
				
				if ( $_POST['bath_del'] ){
					$model_action = $model->where( $where )->delete();
				}
				
				if ( $model_action ){
					$this->assign("jumpUrl", Cookie::get ( '_currentUrl_' ));
					$this->success( '删除成功' );
				}else{
					$this->error( '删除失败' );
				}
			}
		}
		
		
	}